package cn.cy.creation.d03;

public class Client {
    
    // 0 用户
    public static void main(String[] args) {
        AbstractFactory factory = (AbstractFactory) ReadXML1.getInstanceByNameFromConfigFile();
        Product product = factory.newProduct();
        product.show();
    }

    // 1 抽象工厂
    interface AbstractFactory {
        Product newProduct();
    }

    // 2 具体工厂1
    class ConcreteFactory1 implements AbstractFactory {
        @Override
        public Product newProduct() {
            System.out.println("具体工厂1-->生产产品1...");
            return new ConcreteProduct1();
        }
    }
    
    // 3 抽象产品
    interface Product {
        void show();
    }

    // 4 具体产品1
    class ConcreteProduct1 implements Product {
        @Override
        public void show() {
            System.out.println("具体产品1显示...");
        }
    }
    
}
